$(function(){
	init();
});

function init()
{
	$("#btn_submit").bind("click", function(){
		var old_psw = $("#old_pass").val();
		var new_psw = $("#new_pass1").val();
		var rep_psw = $("#new_pass2").val();
		console.log('old_psw: '+ old_psw);
		ajaxoptions.url = 'ajax.php?page=prf&cmd=chg&op='+ old_psw +'&np='+ new_psw +'&rp='+ rep_psw;
		$.ajax(ajaxoptions);	
	});
	
	var ajaxoptions = {
		type    : 'POST',
		url     : 'ajax.php',
		success : function(result, status) {
			console.log(result);
			if(result == 'OK')
			{
				alert('Пароль успешно изменен');
				location.reload();
			}
			else
				alert(result);
		},
		error   : function(xhr, status, error) {
			alert(xhr);
		}
	}
	
	
	
}

